package global

import (
	"context"
	"encoding/json"
	"errors"
	"fmt"

	"2106a-zg5/demo/order/order_srv/models"
)

func SyncRedisData(key string, value []models.Goods) error {
	jsV, _ := json.Marshal(value)
	_, err := RDB.HSet(context.Background(), key, jsV).Result()
	if err != nil {
		fmt.Println(err)
		return errors.New("同步数据失败！！！")
	}
	return nil
}
